package com.lcj.controller;

import com.lcj.vo.UserVo;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
@RequestMapping("/test")
public class TestModelAttribute {
    @ModelAttribute("userVo")
    public UserVo addUser()
    {
        return new UserVo("zahang",12);
    }

    @RequestMapping("/attributes")
    public String attributes(@ModelAttribute("userVo") UserVo userVo){
        userVo.setUsername("lili");
        return "success";
    }
}
